<template>

    <div class="box">
        <horder class="horder">
            <van-nav-bar title="详情" left-text="" left-arrow @click-left="$router.go(-1)" />
        </horder>
        <main class="main">
            <img :src="obj.image" alt="" style="width: 100%;">
            <p>{{ obj.title }}</p>
            <p>{{ obj.price }}</p>
            <van-action-bar>
                <van-action-bar-icon icon="chat-o" text="客服" dot />
                <van-action-bar-icon icon="cart-o" text="购物车" badge="5" />
                <van-action-bar-icon icon="shop-o" text="店铺" badge="12" />
                <van-action-bar-button type="warning" text="加入购物车" />
                <van-action-bar-button type="danger" text="立即购买" @click="$router.push('/login')"/>
            </van-action-bar>
        </main>

    </div>
</template>

<script setup>
import api from '@/api/api'
import { onMounted, ref } from 'vue'
import { useRouter, useRoute } from 'vue-router'
const router = useRouter()
const route = useRoute()
const obj = ref([])
onMounted(() => {
    api.get('/detail', {
        params: { id: route.params.id }
    }).then(res => {
        if (res.data.code == 200) {
            obj.value = res.data.data
        }
    })
})
</script>

<style lang="scss" scoped></style>